<!DOCTYPE html>
<!--解决idea thymeleaf 表达式模板报红波浪线-->
<!--suppress ALL -->
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- 引入公用部分 -->
    <script th:replace="common/head::static"></script>
    <!-- 样式 -->
    <link th:href="@{/sys/authority/css/authority.css}" rel="stylesheet" type="text/css"/>
<!--    <link th:href="@{/common/datatables/css/dataTables.bootstrap.min.css}" rel="stylesheet" type="text/css"/>-->
    <link th:href="@{/common/datatables/css/jquery.dataTables.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/common/select/css/select.dataTables.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/common/Buttons-1.7.0/css/buttons.dataTables.min.css}" rel="stylesheet" type="text/css"/>
</head>
<body>
    <div>
        <a class="layui-btn" onclick="compose()">compose</a>
    </div>
    <table class="display" id="table" lay-filter="test">
        <thead>
        <tr>
            <th>id</th>
            <th>condition</th>
            <th>nums</th>
        </tr>
        </thead>
        <tbody>

        </tbody>
    </table>
</body>
<!-- js -->
<!--<script th:src="@{/ecco/listshow/listshow.js}"></script>-->
<!--<script th:src="@{/common/datatables/js/dataTables.bootstrap.min.js}"></script>-->
<script th:src="@{/common/datatables/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/common/select/js/dataTables.select.min.js}"></script>
<script th:src="@{/common/Buttons-1.7.0/js/dataTables.buttons.min.js}"></script>
<!--<script th:src="@{/common/jquery/jquery.js}"></script>-->
<script type="text/javascript">
    var table=$('#table').DataTable({
        ajax: {
            url: 'http://192.168.56.1:8888/ws/getAssociation',
            // dataTyle:"jsonp",
            dataSrc: "data",
        },
        columns: [
            { "data": "id" },
            { "data": "condition" },
            { "data": "numArtifacts" }
        ],
        select:"true"
    });

    function compose() {
        var selectId=[];
        var selectdata=table.rows({selected:true}).data();
        var i=0;
        while (i<selectdata.length){
            selectId[i]=selectdata[i].id;
            i++;
        }
        var selectId=[1,2,3];
        $.ajax({
            url:'http://192.168.56.1:8888/ws/compose',
            type:'post',
            data: JSON.stringify(selectId),
            dataType: 'JSON',
            contentType: 'application/json',
            success:function (data) {
                alert("success");
            }
        });

        alert(selectId);
    }
</script>
</html>